<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{{ result.city }} 气象报告</title>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <style>
        :root {
            --primary: #4F46E5;
            --gradient: linear-gradient(135deg, #4F46E5 0%, #8B5CF6 100%);
            --text-main: #1E293B;
            --text-secondary: #64748B;
            --bg-light: #F8FAFC;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Roboto', 'Microsoft YaHei', sans-serif;
        }

        body {
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
            padding: 2rem;
            color: var(--text-main);
        }

        .container {
            max-width: 1200px;
            margin: 0 auto;
            position: relative;
        }

        /* 导航和标题 */
        .nav-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 3rem;
        }

        .back-btn {
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            color: var(--primary);
            text-decoration: none;
            padding: 0.8rem 1.5rem;
            border-radius: 0.75rem;
            transition: all 0.2s ease;
            background: white;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
        }

        .back-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
        }

        .page-title {
            text-align: center;
            margin: 2rem 0;
            font-size: 2.5rem;
            color: var(--text-main);
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 1rem;
        }

        /* 数据卡片通用样式 */
        .data-card {
            background: rgba(255, 255, 255, 0.98);
            border-radius: 1.5rem;
            padding: 2rem;
            margin: 2rem 0;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
            opacity: 0;
            transform: translateY(20px);
            animation: cardEnter 0.6s ease-out forwards;
        }

        @keyframes cardEnter {
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .section-title {
            font-size: 1.75rem;
            color: var(--text-main);
            margin-bottom: 2rem;
            padding-bottom: 1rem;
            border-bottom: 3px solid var(--primary);
            display: flex;
            align-items: center;
            gap: 1rem;
        }

        /* 数据网格布局 */
        .data-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
            gap: 1.5rem;
        }

        .data-item {
            padding: 1.5rem;
            background: var(--bg-light);
            border-radius: 1rem;
            transition: all 0.2s ease;
            border: 1px solid rgba(0, 0, 0, 0.05);
        }

        .data-item:hover {
            transform: translateY(-5px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
        }

        .data-label {
            color: var(--text-secondary);
            font-size: 0.95rem;
            margin-bottom: 0.5rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .data-value {
            font-size: 1.6rem;
            color: var(--text-main);
            font-weight: 600;
            line-height: 1.3;
        }

        .unit {
            font-size: 0.9em;
            color: #94a3b8;
            margin-left: 0.3rem;
        }

        /* 预警卡片 */
        .alert-card {
            background: #fff3f3;
            border: 2px solid #ff6b6b;
            margin-top: 3rem;
        }

        .alert-content {
            font-size: 1.1rem;
            line-height: 1.8;
            color: #dc2626;
        }

        .alert-content ul {
            list-style: none;
            padding-left: 1.5rem;
        }

        .alert-content li::before {
            content: "⚠️";
            margin-right: 0.8rem;
        }

        /* 分析按钮 */
        .analysis-cta {
            text-align: center;
            margin: 3rem 0;
        }

        .analysis-btn {
            background: var(--gradient);
            color: white;
            padding: 1.2rem 2.5rem;
            border-radius: 1rem;
            text-decoration: none;
            display: inline-flex;
            align-items: center;
            gap: 1rem;
            transition: all 0.2s ease;
            font-weight: 500;
            box-shadow: 0 4px 6px rgba(79, 70, 229, 0.2);
        }

        .analysis-btn:hover {
            transform: translateY(-3px);
            box-shadow: 0 6px 12px rgba(79, 70, 229, 0.3);
        }

        /* 响应式设计 */
        @media (max-width: 768px) {
            body {
                padding: 1rem;
            }

            .page-title {
                font-size: 2rem;
                flex-direction: column;
            }

            .data-value {
                font-size: 1.4rem;
            }

            .section-title {
                font-size: 1.5rem;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <nav class="nav-header">
            <a href="/" class="back-btn">
                <i class="fas fa-arrow-left"></i>
                返回查询
            </a>
        </nav>

        <h1 class="page-title">
            <i class="fas fa-cloud-sun-rain"></i>
            {{ result.city }} 气象报告
        </h1>

        <!-- 实时数据卡片 -->
        <div class="data-card">
            <h2 class="section-title">
                <i class="fas fa-cloud-sun"></i>
                实时气象数据
            </h2>
            <div class="data-grid">
                {% for key, value in result.weather.items() %}
                <div class="data-item">
                    <div class="data-label">
                        <i class="fas fa-thermometer-half"></i>
                        {{ key }}
                    </div>
                    <div class="data-value">
                        {{ value | replace('(', '<span class="unit">') | replace(')', '</span>') | safe }}
                    </div>
                </div>
                {% endfor %}
            </div>
        </div>

        <!-- 空气质量卡片 -->
        <div class="data-card" style="animation-delay: 0.2s">
            <h2 class="section-title">
                <i class="fas fa-wind"></i>
                空气质量监测
            </h2>
            <div class="data-grid">
                {% for key, value in result.air.items() %}
                <div class="data-item">
                    <div class="data-label">
                        <i class="fas fa-leaf"></i>
                        {{ key }}
                    </div>
                    <div class="data-value">{{ value }}</div>
                </div>
                {% endfor %}
            </div>
        </div>

        <!-- 分析按钮 -->
        <div class="analysis-cta">
            <a href="/analysis?city={{ result.city }}" class="analysis-btn">
                <i class="fas fa-chart-line"></i>
                查看深度分析
            </a>
        </div>

        <!-- 预警卡片 -->
        <div class="data-card alert-card">
            <h2 class="section-title">
                <i class="fas fa-exclamation-triangle"></i>
                系统预警
            </h2>
            <div class="alert-content">
                <ul>
                    {% for item in data.split('\n') %}
                    <li>{{ item | safe }}</li>
                    {% endfor %}
                </ul>
            </div>
        </div>
    </div>
</body>
</html>